
from selenium import webdriver


class DriverTools(object):
    __driver = None

    @classmethod
    def get_driver(cls):
        # 创建浏览器驱动，保证不管调用多少次，返回的都是同一个浏览器驱动
        if cls.__driver is None:
            cls.__driver = webdriver.Edge()
        return cls.__driver

    @classmethod
    def quit_driver(cls):
        # 退出浏览器驱动
        if cls.__driver is not None:
            cls.__driver.quit()

